<template>
  <div class="template-wrap">
    <menu-top></menu-top>
    <div class="content">
      <div class="order-detail">
        <div>
          <menu-left ref="left" :href="href"></menu-left>
        </div>
        <el-col>
          <div class="order-wrap right-content">
            <el-breadcrumb separator-class="el-icon-arrow-right">
              <el-breadcrumb-item :to="{ path: '/ccOrderHand' }">我的订单</el-breadcrumb-item>
              <el-breadcrumb-item>进行中的订单</el-breadcrumb-item>
            </el-breadcrumb>
            <div class="wrap">
              <!-- <div class="title-head">
                待办事项：您好，你本期财务信息尚未提交，<span>点击此处</span>提交财务信息
              </div> -->
              <div class="wrap-container">
                <div class="container-head">
                    <div class="head-list">
                        <span>订单号：</span>{{detail.orderId}}
                    </div>
                    <div class="head-list">
                        <span>融资企业：</span>{{detail.masterOrder.coreData.companyName}}
                    </div>
                    <div class="head-list">
                        <span>贷款产品：</span>{{detail.masterOrder.productData.productName}}
                    </div>
                    <div class="head-list">
                        <span>融资顾问：</span>{{detail.masterOrder.adviserName || '暂无'}}
                    </div>
                    <div class="head-list">
                        <span>业务经理：</span>{{detail.bankServiceManagerName || '暂无'}}
                    </div>
                </div>
                <div class="company-info">
                    <!-- <div class="head-info">
                        <div class="head-name"><span>融资企业：</span>摩拜自行车有限公司</div>
                        <div class="btn">详情</div>
                    </div> -->
                    <!-- <div class="info-main">
                        <div class="info-list">
                            <span>资方：</span>包商银行西藏支行
                        </div>
                        <div class="info-list">
                            <span>资方业务经理：</span>XXX
                        </div>
                    </div> -->
                    <div class="info-wrap">
                        <div class="infos-list">
                            <div class="info-list">
                                <div class="info">贷款产品：<span class="name">{{detail.masterOrder.productData.productName}}</span></div>
                                    <div class="info">
                                    <div class="info-item">
                                        贷款额度：<span>{{detail.masterOrder.productData.loanFundMin}}万 ~ {{detail.masterOrder.productData.loanFundMax}}万</span>
                                    </div>
                                    <div class="info-item">
                                        贷款适用地区：<span>{{detail.masterOrder.productData.financingProvinceName || '--'}}{{detail.masterOrder.productData.financingCityName}}</span>
                                    </div>
                                    </div>
                                    <div class="info">
                                    <div class="info-item">
                                        申请者最低成立年限：<span>{{detail.masterOrder.productData.applyMixYear + '年'}}</span>
                                    </div>
                                    <div class="info-item">
                                        贷款年化利率：<span>{{detail.masterOrder.productData.minReportRate + '%/年'}}</span>
                                    </div>
                                    </div>
                                    <div class="info">
                                    <div class="info-item">
                                        贷款最高期限：<span>{{detail.masterOrder.productData.investYearDesc}}</span>
                                    </div>
                                    <div class="info-item">
                                        申请者最低营业收入要求：<span>{{detail.masterOrder.productData.applyMixIncome}}</span>
                                    </div>
                                    </div>
                                    <div class="info">
                                    <div class="info-item">
                                        资金主体：<span>{{detail.masterOrder.productData && detail.masterOrder.productData.fundBodyDatas ? detail.masterOrder.productData.fundBodyDatas.map(item => item.fundBodyDesc).join(',') || '暂无' : '暂无'}}</span>
                                    </div>
                                    <div class="info-item">
                                        申请者盈利要求：<span v-if="detail.masterOrder.productData.applyProfit == 'y'">需盈利</span>
                                        <span v-else>无要求</span>
                                    </div>
                                    </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="order-state">
                    <div class="title1">当前阶段：<span>{{detail.stepName}}</span></div>
                    <div class="step-wrap">
                        <el-steps :active="active" finish-status="success" align-center>
                            <el-step v-for="(step, index) in steps" :key="index" :title="step.stepName"></el-step>
                        </el-steps>
                    </div>
                    <div class="diligence-info" v-if="(detail.lastCommentDatas || []).length > 0">
                      <div v-for="(data, index) in detail.lastCommentDatas" :key="index">
                        {{data.name}}：<span>{{data.value}}</span>
                      </div>
                    </div>
                </div>
              </div>
            </div>
          </div>
        </el-col>
      </div>
    </div>
  </div>
</template>

<script>
import VueRouter from "vue-router";
import CONSTANT from "../../../constant/constant.js";
import { requestAjax } from "../../../common.js";
import common from "../../../common.js";
let uploadFileParams;

export default {
  data() {
    return {
      href: "",
      steps: [],
      detail: {
        masterOrder: {
          coreData: {},
          productData: {}
        }
      }
    };
  },
  computed: {
    active() {
      const { stepKey } = this.detail;
      return this.steps.findIndex(step => step.stepKey == stepKey);
    }
  },
  created() {
    this.loadStepList();
    this.loadOrderDetail();
  },
  components: {
    "menu-top": () => import("../../common/Menu-Top"),
    "menu-left": () => import("../../common/Menu-Left")
  },
  methods: {
    loadStepList() {
      const url = `${CONSTANT.URL.SYSTEM.STEPLIST}`;
      requestAjax(url, {}, {}, ({ status, data }) => {
        if (status == 200) {
          this.steps = data.bussData;
        }
      });
    },
    loadOrderDetail(stepKey) {
      const id = this.$route.params.id;
      if (!id) return;
      const url = `${CONSTANT.URL.SYSTEM.BANKORDERDETAIL}`;
      const params = {
        orderId: id
      };
      if (stepKey) params.stepKey = stepKey;
      requestAjax(url, JSON.stringify(params), {}, ({ status, data }) => {
        if (status == 200) {
          const { steps } = this;
          this.detail = data.bussData;
        }
      });
    }
  }
};
</script>

<style  lang="scss">
body {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Avenir", Helvetica, Arial, sans-serif;
}

.content {
  min-height: 100%;
  background-color: #f5f5f5;
  width: 81.3%;
  float: right;
}

.content-wrap {
  overflow: hidden;
}

.el-step__title {
  font-size: 14px !important;
}

.el-step__icon:hover {
  transform: scale(1.1, 1.1);
}

.order-detail {
  padding-top: 29px;
  .wrap {
    background-color: #f5f5f5;
    .title-head {
      height: 50px;
      line-height: 50px;
      background-color: #fff;
      margin-top: 18px;
      padding-left: 20px;
      font-size: 14px;
      color: #666;
      span {
        color: #0087dc;
        cursor: pointer;
      }
    }
    .wrap-container {
      padding: 0px 60px 33px 29px;
      background-color: #fff;
      margin-top: 20px;

      .container-head {
        position: relative;
        overflow: hidden;
        height: 67px;
        line-height: 67px;
        padding-bottom: 10px;
        border-bottom: 1px solid #d1d1d1;
        .head-list {
          float: left;
          font-size: 16px;
          color: #000;
          margin-right: 30px;
          span {
            color: #666;
          }
        }
        .head-arrow {
          position: absolute;
          right: 0%;
          cursor: pointer;
          top: 0;
          color: #000;
          font-size: 16px;
          height: 67px;
          line-height: 67px;
          div {
            float: left;
          }
          .arrow {
            width: 22px;
            height: 12px;
            background-image: url(../../../images/arrow.png);
            background-size: 100%;
            margin-top: 28px;
            margin-right: 9px;
            &.rotate {
              transform: rotate(180deg);
              -webkit-transform: rotate(180deg);
            }
          }
        }
      }

      .company-info {
        font-size: 18px;
        color: #333;
        overflow: hidden;
        span {
          color: #666;
        }
        .head-info {
          overflow: hidden;
          height: 78px;
          line-height: 78px;
          border-bottom: 1px solid #d1d1d1;
        }
        .head-name {
          float: left;
        }
        .btn {
          width: 100px;
          height: 40px;
          border-radius: 4px;
          -webkit-border-radius: 4px;
          background-color: #ed7018;
          font-size: 18px;
          color: #fff;
          text-align: center;
          line-height: 40px;
          cursor: pointer;
          float: right;
          margin-top: 20px;
          &:hover {
            background-color: #ed9000;
            transition: all 0.2s linear;
          }
        }
        .info-main {
          position: relative;
          overflow: hidden;
          height: 79px;
          line-height: 79px;
          border-bottom: 1px solid #d1d1d1;
          .info-list {
            float: left;
            font-size: 16px;
            color: #000;
            margin-right: 8%;
            span {
              color: #666;
            }
          }
        }
        .info-wrap {
          background-color: #fff;
          padding: 0 0 29px 0;
          border-bottom: 1px solid #d1d1d1;
          overflow: hidden;
          .info-title {
            width: 35%;
            font-size: 16px;
            color: #333;
            font-weight: bold;
          }
          .infos-list {
            overflow: hidden;
          }
          .info-list {
            width: 80%;
            float: left;
            font-size: 16px;
            color: #666;
            span.name {
              color: #ed7018;
            }
            .info {
              overflow: hidden;
              margin-top: 25px;
              .info-item {
                width: 35.8%;
                float: left;
                &:nth-child(2) {
                  float: left;
                  margin-left: 20%;
                }
              }
              span {
                color: #111;
                font-weight: bold;
              }
              .name {
                color: #ed7018;
              }
            }
          }
        }
      }

      .order-state {
        padding-top: 30px;
        .title1 {
          font-size: 18px;
          color: #000;
          span {
            color: #ed7018;
          }
        }
        .step-wrap {
            margin-left: -30px;
            margin-right: -30px;
            .el-step__title{
                font-size: 13px!important;
            }
            .el-steps {
                .el-step:nth-child(1) {
                  .el-step__main{
                    margin-left: 30px;
                  }
                }
                .el-step:nth-last-child(1) {
                    .el-step__main {
                        margin-right: 30px;
                    }
                }
            }
        }
        .diligence-info {
            line-height: 60px;
            background-color: #f9f9f9;
            font-size: 16px;
            margin-bottom: 20px;
            color: #999999;
            padding-left: 20px;
          div {
            display: inline;
            span {
              color: #000000;
              margin-right: 60px;
            }
          }
        }
        .reply-wrap {
          color: #000;
          padding: 30px 0 0 0;
          .name {
            font-size: 18px;
          }
          .reply-item {
            .reply-list {
              padding: 19px 1.5% 28px;
              margin-top: 20px;
              width: 97%;
              background-color: #f8f8f8;
              .list-title {
                position: relative;
                text-align: center;
                font-size: 14px;
                color: #000;
                span {
                  color: #666;
                }
                .title {
                  position: absolute;
                  left: 0;
                  color: #666;
                }
              }
              .tip {
                margin-top: 19px;
                color: #333;
                font-size: 16px;
              }
              .desc {
                font-size: 14px;
                color: #000;
                margin-top: 18px;
                span {
                  color: #666;
                }
                .upload {
                  display: inline-block;
                  .upload-btn {
                    span {
                      color: #ffffff;
                    }
                  }
                }
              }
              .upload {
                color: #ffffff;
              }
              .reply-input {
                margin-top: 11px;
                .el-textarea {
                  textarea {
                    height: 113px !important;
                  }
                }
              }
              .btn {
                width: 120px;
                height: 40px;
                border-radius: 4px;
                -webkit-border-radius: 4px;
                background-color: #ed7018;
                font-size: 18px;
                color: #fff;
                text-align: center;
                line-height: 40px;
                cursor: pointer;
                margin-top: 20px;
                &:hover {
                  background-color: #ed9000;
                  transition: all 0.2s linear;
                }
              }
              .file-item {
                font-size: 14px;
                overflow: hidden;
                margin-top: 21px;
                .name {
                  float: left;
                  font-size: 14px;
                  color: #999999;
                }
                .item {
                  float: left;
                  width: 80%;
                  .list:last-child {
                    margin-bottom: none;
                  }
                  .list {
                    margin-bottom: 18px;
                    span {
                      color: #666;
                      margin-right: 3%;
                      &.p {
                        color: #999999;
                      }
                    }
                  }
                }
              }
            }
          }
        }
        .answer-wrap {
          margin-top: 21px;
          .label {
            font-size: 14px;
            color: #999999;
          }
          .answer {
            border-radius: 10px;
            background-color: #f2f2f2;
            margin-left: 30px;
            padding-left: 10px;
            padding-bottom: 5px;
            margin-top: 10px;
            .meta {
              span {
                font-size: 14px;
                margin-right: 30px;
                color: #999999;
              }
            }
            .answer-content {
              margin-top: 5px;
              font-size: 16px;
            }
          }
        }
      }
    }
  }
}

a {
  text-decoration: none;
}
</style>px